/*
package cloud.xlh.my_system.config;

import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

import java.io.*;

*/
/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/2/27 13:53
 * @ Description:
 *//*

public class ExBatApplicationContext implements ApplicationContextInitializer<ConfigurableApplicationContext> {

    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        String canalBatPath = "D:\\development\\environment\\canal1.1.6\\setup\\bin\\startup.bat"; // 把你的bat脚本路径写在这里
        String redisBatPath = "D:\\development\\environment\\redis\\setup\\redis-server.exe"; // 把你的bat脚本路径写在这里

        File batFile = new File(canalBatPath);
        boolean batFileExist = batFile.exists();
        System.out.println("batFileExist:" + batFileExist);
        if (batFileExist) {
           */
/* new Thread(new Runnable() {
                @Override
                public void run() {
                    callCmd(canalBatPath);
                }
            }).start();*//*


            new Thread(new Runnable() {
                @Override
                public void run() {
                    callCmd(redisBatPath);
                }
            }).start();
        }
    }

    private static void  callCmd(String locationCmd) {
        StringBuilder sb = new StringBuilder();
        try {
            Process child = Runtime.getRuntime().exec("cmd /k start " + locationCmd);
            InputStream in = child.getInputStream();
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in));
            String line;
           */
/* while ((line = bufferedReader.readLine()) != null) {
                sb.append(line + "\n");
            }*//*

            in.close();
            try {
                child.waitFor();
            } catch (InterruptedException e) {
                System.out.println("------异常---------");
                System.out.println(e);
            }
            System.out.println("sb:" + sb.toString());
            System.out.println("------执行完成---------");
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}
*/
